#include<stdio.h>
#include<stdlib.h>
#include"LinkQueue.h"
#define MAXSIZE 100
void PrintArray(int a[],int n, int N)
{
    int static count = 0;
    for(int i = 0; i < N-count; i++)
    {
        printf("    ");
    }
    count++;
    for(int i = 0; i < n; i++)
    {
        printf("%6d",a[i]);
    }
    printf("\n");
}
int main()
{
    LinkQueue Q;
    DataType t;
    DataType m;
    InitQueue(&Q);
    int temp[MAXSIZE];
    int k;
    EnQueue(&Q,1);
    for(int n = 2; n < 6; n++)
    {
        k = 0;
        EnQueue(&Q,1);
        for(int i = 1; i <= n-2; i++)
        {
            DeQueue(&Q,&t);
            temp[k++] = t;
            GetHead(&Q,&m);
            t = t + m;
            EnQueue(&Q,t);
        }
        DeQueue(&Q,&t);
        temp[k++] = t;
        PrintArray(temp,k,6);
        EnQueue(&Q,1);
    }
    k = 0;
    while(!QueueEmpty(&Q))
    {
        DeQueue(&Q,&t);
        temp[k++] = t;
        if(QueueEmpty(&Q)) PrintArray(temp,k,6);
    }
}